import 'package:flutter/material.dart';
import './pages/indexpage.dart';
class SplashScreen extends StatefulWidget {
 // SplashScreenState({Key key}) : super(key: key);

  @override
  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
  AnimationController _controller;
  Animation _animation;
  @override
  void initState(){
    super.initState();
    _controller=AnimationController( vsync: this, duration:const Duration(milliseconds: 2000));
    _animation=Tween(begin:0.0,end:1.0).animate(_controller);
    _animation.addStatusListener((status) {
    // Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context)=>IndexPage()), (route) =>route==null );
      if(status==AnimationStatus.completed){
        print(AnimationStatus.completed);
       // Navigator.of(context).pushNamed('/');
        Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context)=>IndexPage()), (route) =>route==null );
      }
    });
    _controller.forward();
  }
  @override
  void dispose(){
    _controller.dispose();
    super.dispose(); 
  }
  @override
  Widget build(BuildContext context) {
    
    return FadeTransition(
      opacity: _animation,
    child: Image.network('http://dbyxs.xyz:3005/uploads/b593883c3adac89564d762ae7b76ad5e',scale:2.0,fit:BoxFit.cover),
    );
  }
}